<?php

namespace Addons\Events\Model;

use Think\Model;

class AddonEventsModel extends \BaseModel {
	function load($id) {
		$data = parent::load($id);
		if (!$data) {
			return;
		}

		$data['picUrl'] = ImgDomain . "/" . $data['pic'];
		$data['showInfo'] = cutstr(strip_tags($data['info']), "40");
		$data['expire_date_limit'] = $data['expire_date'] - time();
		$data['expire_date'] = date("Y-m-d H:i", $data['expire_date']);
		$data['topic_count'] = BoxModel("sns_topic")->where(array('pid' => $data['id'], 'type' => 'events'))->count("distinct(user_id)");
		return $data;
	}
}
